<div id="Getting-Notified"></div>
<div class="header">
<p>
Next: [[cvs: How to edit a file which is being watched#How to edit a file which is being watched|Editing files]], Previous: [[cvs: Telling CVS to watch certain files#Telling CVS to watch certain files|Setting a watch]], Up: [[cvs: Mechanisms to track who is editing files#Mechanisms to track who is editing files|Watches]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Telling-CVS-to-notify-you"></div>
==== Telling CVS to notify you ====

You can tell <small>CVS</small> that you want to receive
notifications about various actions taken on a file.
You can do this without using <code>cvs watch on</code> for
the file, but generally you will want to use <code>cvs
watch on</code>, to remind developers to use the <code>cvs edit</code>
command.

<div id="index-watch-add-_0028subcommand_0029"></div>
;<div id="index-cvs-watch-add"></div>Command<nowiki>:</nowiki> <strong>cvs watch add</strong><em> <nowiki>[</nowiki><code>-lR</code><nowiki>]</nowiki> <nowiki>[</nowiki><code>-a</code> <var>action</var><nowiki>]</nowiki>&hellip; <nowiki>[</nowiki><var>files</var><nowiki>]</nowiki>&hellip;</em>

: Add the current user to the list of people to receive notification of work done on <var>files</var>.

: The <code>-a</code> option specifies what kinds of events <small>CVS</small> should notify the user about.  <var>action</var> is one of the following:

:;<code>edit</code>
:: Another user has applied the <code>cvs edit</code> command (described below) to a watched file.

:;<code>commit</code>
:: Another user has committed changes to one of the named <var>files</var>.

:;<code>unedit</code>
:: Another user has abandoned editing a file (other than by committing changes). They can do this in several ways, by:


::* applying the <code>cvs unedit</code> command (described below) to the file


::* applying the <code>cvs release</code> command (see [[cvs: release--Indicate that a Module is no longer in use#release&mdash;Indicate that a Module is no longer in use|release]]) to the file&rsquo;s parent directory (or recursively to a directory more than one level up)


::* deleting the file and allowing <code>cvs update</code> to recreate it


:;<code>all</code>
:: All of the above.

:;<code>none</code>
:: None of the above.  (This is useful with <code>cvs edit</code>, described below.)


: The <code>-a</code> option may appear more than once, or not at all.  If omitted, the action defaults to <code>all</code>.

: The <var>files</var> and options are processed as for <code>cvs watch on</code>.



<div id="index-watch-remove-_0028subcommand_0029"></div>
;<div id="index-cvs-watch-remove"></div>Command<nowiki>:</nowiki> <strong>cvs watch remove</strong><em> <nowiki>[</nowiki><code>-lR</code><nowiki>]</nowiki> <nowiki>[</nowiki><code>-a</code> <var>action</var><nowiki>]</nowiki>&hellip; <nowiki>[</nowiki><var>files</var><nowiki>]</nowiki>&hellip;</em>

: Remove a notification request established using <code>cvs watch add</code>; the arguments are the same.  If the <code>-a</code> option is present, only watches for the specified actions are removed.


<div id="index-notify-_0028admin-file_0029"></div>
When the conditions exist for notification, <small>CVS</small>
calls the &lsquo;<tt>notify</tt>&rsquo; administrative file.  Edit
&lsquo;<tt>notify</tt>&rsquo; as one edits the other administrative
files (see [[cvs: The administrative files#The administrative files|Intro administrative files]]).  This
file follows the usual conventions for administrative
files (see [[cvs: The common syntax#The common syntax|syntax]]), where each line is a regular
expression followed by a command to execute.  The
command should contain a single occurrence of &lsquo;<code>%s</code>&rsquo;
which will be replaced by the user to notify; the rest
of the information regarding the notification will be
supplied to the command on standard input.  The
standard thing to put in the <code>notify</code> file is the
single line:

<div class="example" style="margin-left: 3.2em">
 ALL mail %s -s &quot;CVS notification&quot;
</div>

This causes users to be notified by electronic mail.

<div id="index-users-_0028admin-file_0029"></div>
Note that if you set this up in the straightforward
way, users receive notifications on the server machine.
One could of course write a &lsquo;<tt>notify</tt>&rsquo; script which
directed notifications elsewhere, but to make this
easy, <small>CVS</small> allows you to associate a notification
address for each user.  To do so create a file
&lsquo;<tt>users</tt>&rsquo; in &lsquo;<tt>CVSROOT</tt>&rsquo; with a line for each
user in the format <var>user</var>:<var>value</var>.  Then
instead of passing the name of the user to be notified
to &lsquo;<tt>notify</tt>&rsquo;, <small>CVS</small> will pass the <var>value</var>
(normally an email address on some other machine).

<small>CVS</small> does not notify you for your own changes.
Currently this check is done based on whether the user
name of the person taking the action which triggers
notification matches the user name of the person
getting notification.  In fact, in general, the watches
features only track one edit by each user.  It probably
would be more useful if watches tracked each working
directory separately, so this behavior might be worth
changing.


----

<div class="header">
<p>
Next: [[cvs: How to edit a file which is being watched#How to edit a file which is being watched|Editing files]], Previous: [[cvs: Telling CVS to watch certain files#Telling CVS to watch certain files|Setting a watch]], Up: [[cvs: Mechanisms to track who is editing files#Mechanisms to track who is editing files|Watches]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
